<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>


<%@include file="comon.jsp"%>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>
                    <small>教练管理</small>
                </h1>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 column">
                <%--toAddMember--%>
                <a class="btn btn-primary" href="${pageContext.request.contextPath}/Coach/toAddCoach">添加教练</a>
                <a class="btn btn-primary" href="${pageContext.request.contextPath}/Coach/allCoach">查询所有教练</a>
            </div>
            <div class="col-md-8 column">
                <%--添加功能：搜索教练--%>
                <form class="form-inline" action="${pageContext.request.contextPath}/Coach/queryCoach" method="post" style="float: right">
                    <span style="color: red;font-weight: bold">${error}</span>
                    <input type="text" value="" name="fitnessId" class="form-control" placeholder="请输入要查询的教练id"/>
                    <input type="submit" class="btn btn-primary" value="搜索">
                </form>
            </div>

        </div>
        <div class="row clearfix">
            <div class="col-md-12 column">
                <table class="table table-hover table-striped table-bordered">
                    <thead>
                    <tr>
                        <th>教练id</th>
                        <th>教练名字</th>
                        <th>教练性别</th>
                        <th>教练工资</th>
                        <th>教练电话</th>
                        <th>教练年龄</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <%--
                    从数据库中查询出来，从这个list集合中遍历出来每一本member
                    每一本member中还有属性
                    --%>
                    <tbody>
                    <c:forEach var="coach" items="${list}">
                        <tr>
                            <td>${coach.fitnessId}</td>
                            <td>${coach.fitnessName}</td>
                            <td>${coach.fitnessSex}</td>
                            <td>${coach.fitnessWages}</td>
                            <td>${coach.fitnessNumber}</td>
                            <td>${coach.fitnessAge}</td>
                            <td>
                                <a href="${pageContext.request.contextPath}/Coach/toUpdateCoach?fitnessId=${coach.fitnessId}" >修改</a>
                                &nbsp; | &nbsp;
                                <a href="${pageContext.request.contextPath}/Coach/deleteCoach?fitnessId=${coach.fitnessId}">删除</a>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    </section>
    <script src="${pageContext.request.contextPath}/js/script.js"></script>
    </body>

    </html>